pub struct FixedCapacityStackOfStrings {
    a: Vec<String>,
}
impl FixedCapacityStackOfStrings {
    pub fn push(&mut self, item: String) {
        self.a.push(item);
    }
    pub fn pop(&mut self) -> String {
        // self.a.pop();
        match self.a.pop() {
            Some(item) => item,
            None => panic!("called `FixedCapacityStackOfStrings::pop()` on a `None` value"),
        }
    }
    pub fn isEmpty(&mut self) -> bool {
        return self.a.is_empty();
    }
    pub fn size(&mut self) -> usize {
        return self.a.len();
    }
    pub fn new(size: usize) -> FixedCapacityStackOfStrings {
        FixedCapacityStackOfStrings {
            a: Vec::with_capacity(size),
        }
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn test() {
        let mut test = super::FixedCapacityStackOfStrings::new(10);
        test.push(String::from("liu"));
        test.push(String::from("xiao"));
        test.push(String::from("bing"));
        println!("{}", test.pop());
        println!("size:{}", test.size());
        println!("isEmpty:{}", test.isEmpty());
    }
}
